;
var www_common_ops = {
    init:function(){
       this.eventBind();
       this.setCurrentNav();
       this.resetHelp();
    },
    eventBind:function(){
        var that = this;
        var winHeight = $(window).height();
        $(window).scroll(function() {
      		if($(window).scrollTop() >= winHeight){
      			$('.back_top').fadeIn(300);
      		}else{
      			$('.back_top').fadeOut(300);
      		}
      	});
        $('.back_top').click(function(){
      	   $('html,body').animate({scrollTop: '0px'}, 800);
        });
        $(".close_contact").click(function() {
          $(".online_contact").hide();
        });
    },
    setCurrentNav:function(){
      var pathname = window.location.pathname;
      idx = 0 ;
      if( pathname == "/" || pathname.indexOf("/default/main") > -1 ){
          idx = 1;
      }

      if( pathname.indexOf("/default/product_studio") > -1 || pathname.indexOf("/default/product_club") > -1 || pathname.indexOf("/default/product_beauty") > -1  ){
          idx = 2;
      }

      if( pathname.indexOf("/default/service") > -1 ){
          idx = 3;
      }

      if( pathname.indexOf("/default/aboutus") > -1 ){
          idx = 4;
      }

      if( idx < 1 ){
          return;
      }
      var target = $( $(".nav_list a").get(idx - 1) );
      target.addClass("current");
    },
    resetHelp:function(){
      window.KF5SupportBoxAPI.ready(function(){
           window.KF5SupportBoxAPI.removeButton();
           $(".help_me").click(function() {
             window.KF5SupportBoxAPI.open();
           });
      });
    }
};

$(document).ready(function(){
    www_common_ops.init();
});
